package com.shierke.Ume.ui.adapter.me

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.shierke.Ume.R
import com.shierke.Ume.ui.activity.TrensChooseLocationActivity
import com.shierke.Ume.util.click
import kotlinx.android.synthetic.main.item_location_search_result.view.*

/**
 * Create by Ybx
 * on 2020-10-27
 * Desribe:
 */
class LocationResultAdapter : RecyclerView.Adapter<LocationResultAdapter.ViewHolder>() {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {

        val view = LayoutInflater.from(parent.context)
            .inflate(R.layout.item_location_search_result, null, false)


        return ViewHolder(view)

    }

    override fun getItemCount() = 6

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        holder.onBind()
    }


    class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {


        fun onBind() {
            with(itemView) {
                locationNext.click {
                    TrensChooseLocationActivity.startActivity(context)
                }
            }

        }


    }
}